package com.lmb.service.impl;

import com.lmb.bean.ResidentEmergencies;
import com.lmb.mapper.ResidentEmergenciesDao;
import com.lmb.service.ResidentEmergenciesService;
import com.lmb.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ResidentEmergenciesImpl implements ResidentEmergenciesService {
    @Autowired
    ResidentEmergenciesDao residentEmergenciesDao;

    @Override
    public ResidentEmergencies add(ResidentEmergencies residentEmergencies) {
        residentEmergenciesDao.add(residentEmergencies);
        ResidentEmergencies result=residentEmergenciesDao.one(residentEmergencies.getId());
        return result;
    }

    @Override
    public ResidentEmergencies edit(ResidentEmergencies residentEmergencies) {
        residentEmergenciesDao.edit(residentEmergencies);
        ResidentEmergencies result=residentEmergenciesDao.one(residentEmergencies.getId());
        return result;
    }

    @Override
    public int del(Integer id) {
        return residentEmergenciesDao.del(id);
    }

    @Override
    public ResidentEmergencies one(Integer id) {
        return residentEmergenciesDao.one(id);
    }

    @Override
    public List<ResidentEmergencies> all(ResidentEmergencies residentEmergencies) {

        return residentEmergenciesDao.all(residentEmergencies);
    }

    @Override
    public void page(Page page, ResidentEmergencies residentEmergencies) {
        int count= residentEmergenciesDao.pageCount(residentEmergencies);
        Object data= residentEmergenciesDao.page(page, residentEmergencies);
        page.setCount(count);
        page.setData(data);
    }
}
